-
-
Notifications
You must be signed in to change notification settings - Fork 307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib/gis: modernize getl2() #3850
Conversation
- modernize C code to simplify code - do not fail with different newline types (Linux vs Windows vs ...) This PR attempts to address CI errors like `ERROR: Cannot open filter file 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\grass8-runneradmin-6736\\tmph6va8xp9'\r\n`
@echoix please check if this helps for the Windows tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is shorter using standard functions, possibly faster. I did not find a reason for the current code except that it was trying to avoid usage of string.h. The reason for it likely don't exist anymore.
Working on it |
The possible time difference measured in the windows CI run seems like a coincidence, maybe by getting allocated a more performant CPU at that time. Some other builds on main and PRs took less time than here, and others took more. So nothing to conclude. But overall, this code is at least shorter and direct. |
- modernize C code to simplify code - do not fail with different newline types (Linux vs Windows vs ...) This PR attempts to address CI errors like `ERROR: Cannot open filter file 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\grass8-runneradmin-6736\\tmph6va8xp9'\r\n`
Use G_getl2 in G_getl to have everywhere the same behavior of supporting all newlines. Originally, G_getl2 was created to keep the behavior of G_getl. However, now, we want G_getl2 behavior everywhere. Keeping G_getl2 for compatibility. Code can later be clean up to use only G_getl, probably at the time when G_getl2 is removed (v9). The new test fails without the change in the library for CRLF for G_getl, but passes with the change. CR fails because it is not supported by fgets used since 88090da (#3850), so expecting failure for CR. Return and argument types for ctypes fopen need to be set for the code to work everywhere reliably. --------- Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>
Use G_getl2 in G_getl to have everywhere the same behavior of supporting all newlines. Originally, G_getl2 was created to keep the behavior of G_getl. However, now, we want G_getl2 behavior everywhere. Keeping G_getl2 for compatibility. Code can later be clean up to use only G_getl, probably at the time when G_getl2 is removed (v9). The new test fails without the change in the library for CRLF for G_getl, but passes with the change. CR fails because it is not supported by fgets used since 88090da (OSGeo#3850), so expecting failure for CR. Return and argument types for ctypes fopen need to be set for the code to work everywhere reliably. --------- Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>
This PR attempts to address CI errors like (source):
ERROR: Cannot open filter file 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\grass8-runneradmin-6736\\tmph6va8xp9'\r\n